﻿<UserControl x:Class="Bookvar.UI.AttachmentButton"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:ui="clr-namespace:Bookvar.UI.Commands"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    DataContext="{Binding Topic, RelativeSource={x:Static RelativeSource.Self}}">

	<UserControl.Resources>
		<DataTemplate x:Key="template">
			<TextBlock Text="{Binding FileName}" />
		</DataTemplate>

        <Style TargetType="Button" x:Key="AttachmentButton">
            <Setter Property="Width" Value="25"></Setter>
            <Setter Property="Height" Value="25"></Setter>
            <Setter Property="Background" Value="Transparent"></Setter>
        </Style>
    </UserControl.Resources>

	<Button Command="ui:BookvarUICommands.ShowAttachments" Style="{StaticResource AttachmentButton}"
			CommandParameter="{Binding}">
		<Button.ToolTip>
			<ItemsControl ItemTemplate="{StaticResource template}" ItemsSource="{Binding Attachments}" >
			</ItemsControl>
		</Button.ToolTip>

		<Image Source="pack://application:,,,/BookvarWPF;component/Resources/Icons/32x32/attach32.png" Width="16" Height="16" />
	</Button>

</UserControl>
